#ifndef YUANSHENPLAY_MIDIFILE_H
#define YUANSHENPLAY_MIDIFILE_H

#include <functional>
#include "MidiTrack.h"
#include "Util.h"

class MidiFile {
public:
    float time;
    uint16_t format;
    uint16_t track;
    uint16_t TimeBase;
    std::vector<MidiTrack> Tracks;

    std::function<void(uint8_t, uint8_t, uint8_t)> fun_8x;
    std::function<void(uint8_t, uint8_t, uint8_t)> fun_9x;
    std::function<void(uint8_t, uint8_t, uint8_t)> fun_Ax;
    std::function<void(uint8_t, uint8_t, uint8_t)> fun_Bx;
    std::function<void(uint8_t, uint8_t)> fun_Cx;
    std::function<void(uint8_t, uint8_t)> fun_Dx;
    std::function<void(uint8_t, uint8_t)> fun_Ex;
    std::function<void(std::vector<uint8_t>)> fun_F0;
    std::function<void(uint8_t, std::vector<uint8_t>)> fun_FF;

    MidiFile(const std::string &filename, float time = 1000.0f);

    void play(const std::vector<bool> &track_flag = {});
};


#endif //YUANSHENPLAY_MIDIFILE_H
